#include<iostream>
#include<deque>
#include<vector>
 
using namespace std;

template<typename T1, typename T2,typename T3>  
void fixed_size_push_back(T1 &cur_pos, T2 data, T3 length){
    if(cur_pos.size()<length)
        cur_pos.push_back(data);
    else{
        cur_pos.pop_front();
        cur_pos.push_back(data);
    }
}

int main()
{
	deque<int> d;
    cout<<d.size()<<endl;
	d.push_back( 10 );
	d.push_back(20);
	d.push_back(30);
	cout<<"原始双端队列："<<endl;
	for(int i = 0; i < d.size(); i++)
	{
		cout<<d.at(i)<<"\t";
	}

    fixed_size_push_back(d, 1, 3);
	d.erase(d.begin()+1);
	cout<<d.size()<<endl;
    // fixed_size_push_back(d, 2, 3);
    // fixed_size_push_back(d, 3, 3);



	cout<<endl;
	// d.push_front(5);
	// d.push_front(3);
	// d.push_front(1);
 
	cout<<"after push_front(5.3.1):"<<endl;
	for(int i = 0;i < d.size();i++)
	{
		cout<<d.at(i)<<"\t";
	}
	cout<<endl;
	d.pop_front();
	d.pop_front();
	cout<<"after pop_front() two times:"<<endl;
	for(int i = 0;i < d.size();i++)
	{
		cout<<d.at(i)<<"\t";
	}
	cout<<endl;

	vector<float> v(3);
	cout<<"v size "<<v.size()<<endl;
	return 0;
}
